#!/bin/bash
if [ ! -n "${1}" ] || [ ! -n "${2}" ]
	then
        echo "ERROR! mysql-flush-readonly param error, request rootPassword, readtype"
        exit 0;
fi
mysql -uroot -p${1} -e "set global read_only=${2};"
read_only=`mysql -uroot -p${1} -e "show global variables like 'read_only';" | grep read_only | awk '{print $2}'`
echo $read_only  
